import re

w = open("boss_spell.txt", 'r')

template = w.read()

w.close()


#regex
GET_UNIT = re.compile(r'Hunter Killer \(Hydralisk\)')
GET_NICKNAME = re.compile(r'(?<=Boss)Hydra')
GET_NICKNAME2 = re.compile(r'(?<=Boss )Hydra')
GET_TIMER_DC = re.compile(r'Zerg Hydralisk Den')
GET_SPELL_DC = re.compile(r'Zerg Spore Colony')
GET_SWITCH_NUMBER = re.compile(r'Switch97')

def spell_macro(unit, nickname, timer_dc, spell_dc, switch_number):
    new_str = template
    new_str = GET_UNIT.sub(unit, new_str)
    new_str = GET_NICKNAME.sub(nickname, new_str)
    new_str = GET_NICKNAME2.sub(nickname, new_str)
    new_str = GET_TIMER_DC.sub(timer_dc, new_str)
    new_str = GET_SPELL_DC.sub(spell_dc, new_str)
    new_str = GET_SWITCH_NUMBER.sub(switch_number, new_str)
    return new_str


w = open('boss_spells.txt', 'w')

#print>>w, spell_macro('Protoss Dragoon', 'Goon', 'Protoss Cybernetics Core', 'Zerg Spore Colony', 'Switch95')

#print>>w, spell_macro('Zerg Ultralisk', 'Ultra', 'Zerg Ultralisk Cavern', 'Zerg Sunken Colony', 'Switch94')

#print>>w, spell_macro('Zerg Lurker', 'Lurker', 'Zerg Extractor', 'Protoss Nexus', 'Switch93')

#print>>w, spell_macro('Zerg Defiler', 'Defiler', 'Zerg Defiler Mound', 'Protoss Forge', 'Switch92')

#print>>w, spell_macro('Infested Duran', 'Ghost', 'Infested Command Center', 'Protoss Stargate', 'Switch91')

#print>>w, spell_macro('Gui Montag (Firebat)', 'Bat', 'Protoss Templar Archives', 'Protoss Fleet Beacon', 'Switch89')

#print>>w, spell_macro('Infested Kerrigan (Infested Terran)', 'Kerry', 'Zerg Spawning Pool', 'Zerg Cerebrate Daggoth', 'Switch88')

#print>>w, spell_macro('Tassadar/Zeratul (Archon)', 'Archon', 'Protoss Citadel of Adun', 'Protoss Arbiter Tribunal', 'Switch87')

print>>w, spell_macro('Alan Schezar (Goliath)', 'Gol', 'Protoss Temple', 'Stasis Cell/Prison', 'Switch86')

print>>w, spell_macro('Torrasque (Ultralisk)', 'Tor', 'Zerg Egg', 'Zerg Lurker Egg', 'Switch85')

print>>w, spell_macro('Protoss Reaver', 'Reav', 'Protoss Robotics Facility', 'Warbringer (Reaver)', 'Switch84')

w.close()
